package com.orhon.smartcampus.modules.systemctl.mm;


import com.orhon.smartcampus.modules.base.mm.*;
import com.orhon.smartcampus.modules.systemctl.entity.OrgDuties;
import com.orhon.smartcampus.modules.systemctl.gqlModel.GQLDuty;
import com.orhon.smartcampus.modules.user.mm.UserMapper;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;


@Mapper(uses = {
        DictionaryMapper.class,
        LangMapper.class,
        UserMapper.class,
        
})
public interface DutiesMapper {

    DutiesMapper MAPPER = Mappers.getMapper(DutiesMapper.class);

    @Mapping(source = "id" , target = "id")
    @Mapping(source = "dutiesName" , target = "duties_name")
    @Mapping(source = "dutiesOrder" , target = "duties_order")
    @Mapping(target = "parent" , ignore = true)
    @Mapping(source = "level" , target = "level",qualifiedByName = "str2dic")
    @Mapping(target = "users" , ignore = true)
    @Mapping(target = "userList" , ignore = true)
    GQLDuty toOrgDuties(OrgDuties entity);
    
    @InheritConfiguration(name = "toOrgDutiesList")
    List<GQLDuty> toOrgDutiesList(List<OrgDuties> entities);

}
